package com.lovvyang.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author lovvyang
 * @date 2020/6/10-22:42
 */
@WebServlet("/servletContext03")
public class ServletContext03 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletContext servletContext = request.getServletContext();
        String a = servletContext.getRealPath("/WEB-INF/classes/a.txt");
        String b = servletContext.getRealPath("/b.txt");
        String c = servletContext.getRealPath("/WEB-INF/c.txt");
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);

    }
}
